#include <stdio.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>


int main(int argc, char* argv[]) {
    char buffer[1024];
    int fd = open(argv[1], O_RDONLY);
    if(fd == -1) printf("open error!\n");
    else {
        int status;
        while(status = read(fd, buffer, 1024)) {
            if(status == 1024)
                printf("%s", buffer);
            else {
                buffer[status] = '\0';
                printf("%s", buffer);
            }
        }
    }
    close(fd);
    return 0;
}
